import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // {
    //   path: '/',
    //   name: 'home',
    //   component: HomeView,
    // },
    // {
    //   path: '/about',
    //   name: 'about',
    //   // route level code-splitting
    //   // this generates a separate chunk (About.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import('../views/AboutView.vue'),
    // },
    {
      path: '/',
      name: 'index',
      component: () => import('@/views/index.vue'),
    },
    {
      path: '/chat',
      name: 'chat',
      component: () => import('@/views/chat.vue'),
    },
    {
      path: '/file',
      children: [
        {
          path: "view/:fileId(\\d+)",
          component: () => import("@/views/view.vue"),
          name: 'FileView',
          meta: { title: "文件预览"}
        },
        {
          path: "edit/:fileId(\\d+)",
          component: () => import("@/views/edit.vue"),
          name: 'FileEdit',
          meta: { title: "文件在线编辑"}
        },
      ]
    },
    {
      path: '/findproblem',
      children: [
        {
          path: 'list',
          component: () => import("@/views/findproblem/list.vue"),
          name: 'FindProblemList',
          meta: { title: "关卡列表"}
        },
        {
          path: 'add',
          component: () => import("@/views/findproblem/add.vue"),
          name: 'AddFindProblem',
          meta: { title: "新增关卡"}
        },
        {
          path: 'edit/:id',
          component: () => import("@/views/findproblem/edit.vue"),
          name: 'EditFindProblem',
          meta: { title: "编辑关卡"}
        }
      ]
    }
  ],
})

export default router
